package com.yootk.webflux.handler;

import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

/**
 * WebFlux请求处理
 */
@Component
public class MessageHandler {

    public Mono<ServerResponse> echoHandler(ServerRequest request) {
        return ServerResponse.ok()
                .header("Content-Type", "text/html;charset=UTF-8")  // 响应头信息
                .body(BodyInserters.fromValue("沐言科技：www.yootk.com"));
    }
}
